package com.breeze.media.video;

import android.os.Bundle;
import android.widget.MediaController;
import android.widget.VideoView;

import androidx.appcompat.app.AppCompatActivity;

import com.breeze.media.R;

public class VideoViewActivity extends AppCompatActivity {

    private VideoView videoView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_video_view);
        videoView = findViewById(R.id.video_view);
        //获取test720.mp4的uri地址
        String uri = "android.resource://" + getPackageName() + "/" + R.raw.test720;
        videoView.setVideoPath(uri);
        videoView.setMediaController(new MediaController(this)); // 视频会加入默认播放/暂停控制按钮
    }
}